#define _CRT_SECURE_NO_WARNINGS 1

int countTestedDevices(int* batteryPercentages, int batteryPercentagesSize) {
    int count = 0;
    int i = 0;
    for (i = 0; i < batteryPercentagesSize; i++)
    {
        if (batteryPercentages[i] - count > 0)
        {
            count++;
        }
        else
        {
            batteryPercentages[i] = 0;
        }
    }
    return count;
}